﻿using System;
using System.Threading;
using Mono.Collections.Generic;

namespace Mono.Cecil.Cil
{
	// Token: 0x02000138 RID: 312
	public sealed class ScopeDebugInformation : DebugInformation
	{
		// Token: 0x17000300 RID: 768
		// (get) Token: 0x06000BB7 RID: 2999 RVA: 0x00034C24 File Offset: 0x00032E24
		// (set) Token: 0x06000BB8 RID: 3000 RVA: 0x000062BA File Offset: 0x000044BA
		public InstructionOffset Start
		{
			get
			{
				return this.start;
			}
			set
			{
				this.start = value;
			}
		}

		// Token: 0x17000301 RID: 769
		// (get) Token: 0x06000BB9 RID: 3001 RVA: 0x00034C3C File Offset: 0x00032E3C
		// (set) Token: 0x06000BBA RID: 3002 RVA: 0x000062C4 File Offset: 0x000044C4
		public InstructionOffset End
		{
			get
			{
				return this.end;
			}
			set
			{
				this.end = value;
			}
		}

		// Token: 0x17000302 RID: 770
		// (get) Token: 0x06000BBB RID: 3003 RVA: 0x00034C54 File Offset: 0x00032E54
		// (set) Token: 0x06000BBC RID: 3004 RVA: 0x000062CE File Offset: 0x000044CE
		public ImportDebugInformation Import
		{
			get
			{
				return this.import;
			}
			set
			{
				this.import = value;
			}
		}

		// Token: 0x17000303 RID: 771
		// (get) Token: 0x06000BBD RID: 3005 RVA: 0x00034C6C File Offset: 0x00032E6C
		public bool HasScopes
		{
			get
			{
				return !this.scopes.IsNullOrEmpty<ScopeDebugInformation>();
			}
		}

		// Token: 0x17000304 RID: 772
		// (get) Token: 0x06000BBE RID: 3006 RVA: 0x00034C8C File Offset: 0x00032E8C
		public Collection<ScopeDebugInformation> Scopes
		{
			get
			{
				bool flag = this.scopes == null;
				if (flag)
				{
					Interlocked.CompareExchange<Collection<ScopeDebugInformation>>(ref this.scopes, new Collection<ScopeDebugInformation>(), null);
				}
				return this.scopes;
			}
		}

		// Token: 0x17000305 RID: 773
		// (get) Token: 0x06000BBF RID: 3007 RVA: 0x00034CC4 File Offset: 0x00032EC4
		public bool HasVariables
		{
			get
			{
				return !this.variables.IsNullOrEmpty<VariableDebugInformation>();
			}
		}

		// Token: 0x17000306 RID: 774
		// (get) Token: 0x06000BC0 RID: 3008 RVA: 0x00034CE4 File Offset: 0x00032EE4
		public Collection<VariableDebugInformation> Variables
		{
			get
			{
				bool flag = this.variables == null;
				if (flag)
				{
					Interlocked.CompareExchange<Collection<VariableDebugInformation>>(ref this.variables, new Collection<VariableDebugInformation>(), null);
				}
				return this.variables;
			}
		}

		// Token: 0x17000307 RID: 775
		// (get) Token: 0x06000BC1 RID: 3009 RVA: 0x00034D1C File Offset: 0x00032F1C
		public bool HasConstants
		{
			get
			{
				return !this.constants.IsNullOrEmpty<ConstantDebugInformation>();
			}
		}

		// Token: 0x17000308 RID: 776
		// (get) Token: 0x06000BC2 RID: 3010 RVA: 0x00034D3C File Offset: 0x00032F3C
		public Collection<ConstantDebugInformation> Constants
		{
			get
			{
				bool flag = this.constants == null;
				if (flag)
				{
					Interlocked.CompareExchange<Collection<ConstantDebugInformation>>(ref this.constants, new Collection<ConstantDebugInformation>(), null);
				}
				return this.constants;
			}
		}

		// Token: 0x06000BC3 RID: 3011 RVA: 0x000062D8 File Offset: 0x000044D8
		internal ScopeDebugInformation()
		{
			this.token = new MetadataToken(TokenType.LocalScope);
		}

		// Token: 0x06000BC4 RID: 3012 RVA: 0x00034D74 File Offset: 0x00032F74
		public ScopeDebugInformation(Instruction start, Instruction end) : this()
		{
			bool flag = start == null;
			if (flag)
			{
				throw new ArgumentNullException("start");
			}
			this.start = new InstructionOffset(start);
			bool flag2 = end != null;
			if (flag2)
			{
				this.end = new InstructionOffset(end);
			}
		}

		// Token: 0x06000BC5 RID: 3013 RVA: 0x00034DBC File Offset: 0x00032FBC
		public bool TryGetName(VariableDefinition variable, out string name)
		{
			name = null;
			bool flag = this.variables == null || this.variables.Count == 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				for (int i = 0; i < this.variables.Count; i++)
				{
					bool flag2 = this.variables[i].Index == variable.Index;
					if (flag2)
					{
						name = this.variables[i].Name;
						return true;
					}
				}
				result = false;
			}
			return result;
		}

		// Token: 0x0400073B RID: 1851
		internal InstructionOffset start;

		// Token: 0x0400073C RID: 1852
		internal InstructionOffset end;

		// Token: 0x0400073D RID: 1853
		internal ImportDebugInformation import;

		// Token: 0x0400073E RID: 1854
		internal Collection<ScopeDebugInformation> scopes;

		// Token: 0x0400073F RID: 1855
		internal Collection<VariableDebugInformation> variables;

		// Token: 0x04000740 RID: 1856
		internal Collection<ConstantDebugInformation> constants;
	}
}
